package com.changgou.goods.feign;


import com.changgou.goods.pojo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
 * @Author:huanmin
 */
@FeignClient(name="user")
@RequestMapping("/user")
public interface UserFeign {

    /***
     * User分页条件搜索实现
     * @param user
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/search/{page}/{size}" )
    ResponseEntity findPage(@RequestBody(required = false) User user, @PathVariable  int page, @PathVariable  int size);

    /***
     * User分页搜索实现
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/search/{page}/{size}" )
    ResponseEntity findPage(@PathVariable  int page, @PathVariable  int size);

    /***
     * 多条件搜索品牌数据
     * @param user
     * @return
     */
    @PostMapping(value = "/search" )
    ResponseEntity findList(@RequestBody(required = false) User user);

    /***
     * 根据ID删除品牌数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/{id}" )
    ResponseEntity delete(@PathVariable Integer id);

    /***
     * 修改User数据
     * @param user
     * @param id
     * @return
     */
    @PutMapping(value="/{id}")
    ResponseEntity update(@RequestBody User user,@PathVariable Integer id);

    /***
     * 新增User数据
     * @param user
     * @return
     */
    @PostMapping
    ResponseEntity add(@RequestBody User user);

    /***
     * 根据ID查询User数据
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    ResponseEntity findById(@PathVariable Integer id);

    /***
     * 查询User全部数据
     * @return
     */
    @GetMapping
    ResponseEntity findAll();
}